#ifndef EXPORTFILESERVICE_H
#define EXPORTFILESERVICE_H

#include <fstream>
#include<iostream>
#include<QHash>
#include<QString>
#include<vector>
#include<string>
#include<QPCR.h>
#include <QDebug>
#include<Constant.h>
#include<InstructionsService.h>
#include<QTextCodec>
#include"qtxlsx/src/xlsx/xlsxdocument.h"
#include"qtxlsx/src/xlsx/xlsxworkbook.h"

#define EXPORT_SLEEP_TIME 1 // 宏定义：导出休眠变量(单位：ms)



class ExportFileService
{
public:
    ExportFileService();

    QString shiyanID;
    QString filename;
    QList <QString>reactionPlace32={
                                    "A1","A2","A3","A4",
                                    "B1","B2","B3","B4",
                                    "C1","C2","C3","C4",
                                    "D1","D2","D3","D4",
                                    "E1","E2","E3","E4",
                                    "F1","F2","F3","F4",
                                    "G1","G2","G3","G4",
                                    "H1","H2","H3","H4",
                                 };

    QList <QString>reactionPlace16={
                                    "A1","A2",
                                    "B1","B2",
                                    "C1","C2",
                                    "D1","D2",
                                    "E1","E2",
                                    "F1","F2",
                                    "G1","G2",
                                    "H1","H2"
                                 };

    QList<QHash<QString,QString>> reactionInfo;
    QXlsx::Format numericFormat;

    bool init(QString ID, QString mingCheng, QString path);

    bool yangben2EXCEL(QList<QString>,Sample sampleList[96],Target targetList[96][20]);
    bool yingguang2EXCEL(QList<QString> info,QList<QList<QHash<QString, QString>>> yingGuangData);
    bool kuozeng2EXCEL(QList<QString> info,QList<QList<QHash<QString, QString>>> niheyingGuangData,QList<QList<QHash<QString, QString>>> deltayingGuangData,QHash<QString,QString> targetTable, QList<QString> ct, QString haoCai);
    bool yuanshi2EXCEL(QList<QString> info,QList<QList<QHash<QString, QString>>> yingGuangData);
    const wchar_t *str2char(QString);
    void rename();

    QList<QHash<QString,QString>> disposeReactionWells(Sample sampleList[96],Target targetList[96][20]);

    bool exportFinished(); // 导出结束函数

private:
    /* 休眠函数 */
    void sleep(int msec);
};

#endif // EXPORTFILESERVICE_H
